1. There are two functions available in Visual Basic to determine the class of an object: the TypeOf and TypeName functions.
2. The WithEnd With statements are efficient only when you are working with many properties of a control. When assigning only one or two properties it is better to just code the full statements.
3. All collections share four objects:
Add method
Remove method
Item method
Count property
4. You can create a new instance of a class or an object by declaring it in the Declarations section as follows:
Private myObj as New [object]
The object is created on the first reference in the code.
Exercise
To create an application that places new controls on the form when a command button is clicked, you must place one copy of the control on the form and set its visible property to False and its Index property to 0. This will properly create the control array. Then, every time you must add another copy of the control to the form, load the next element in the array and make it visible. The code for this exercise is shown in Listing A.1.
LISTING A.1. CHAP5EXE.TXTTHE FINISHED CODE FOR THE EXERCISE.
Dim txtTop As Integer
Dim txtLeft As Integer
Dim txtCount As Integer
Dim txtHeight As Integer
Dim txtWidth As Integer